﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
using U9API.Pub;
using U9API.JsonModel;

namespace U9API.APIHelper
{
    public abstract class BaseHelper<T> : ICreateHelper<T> where T : JsonModel.BaseEntity
    {
        public String billid;
        public String csource { get; set; }

        private String _u9constr;
        public String U9Constr
        {
            get { return this._u9constr; }
        } 
        public BaseHelper()
        {
            this._u9constr = U9API.Pub.EncryptDecryptService.DESDecrypt(U9API.Pub.EncryptDecryptService.strDESKey, ConfigHelper.ConnectionString);   
        }

        public void Create(String orgcode, int operation, T model)
        {
            try
            {
                this.Create(orgcode, operation, new List<T>() { model });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        protected abstract void Create(string orgcode, int operation, List<T> model);
         
    }

    
     
}
